Find Out Links

I know there's something that will do this, but I'm totally blanking on what it is.  If I want to only show objects which have out links (and then want to look at attributes in the objects that are linked to), how do I make that happen?  I've done it before in one of my programs, but I can't remember which one it was, and couldn't find it when I looked through all of my programs.

Thanks!


josiah820 - Tue Jun 11 15:46:45 EDT 2013

Re: Find Out Links
Richard_Hesketh - Wed Jun 12 03:12:46 EDT 2013

Try the attached code. I couldn't (easily) get it to format nicely for display in the post!


Attachments

displayOutLinks.dxl

Re: Find Out Links
kabr - Wed Jun 12 04:58:24 EDT 2013

Try Analysis Wizard to create a layout DXL column.

With options 'All modules' or 'All open modules' you get a grip only on standard DOORS attributes in partner module.

With option 'Specific' you get a grip on all attributes in your partner module.

 

rgds

Karl

Re: Find Out Links
llandale - Wed Jun 12 10:18:07 EDT 2013

kabr - Wed Jun 12 04:58:24 EDT 2013

Try Analysis Wizard to create a layout DXL column.

With options 'All modules' or 'All open modules' you get a grip only on standard DOORS attributes in partner module.

With option 'Specific' you get a grip on all attributes in your partner module.

 

rgds

Karl

.... when the layout displays what you want from the other module, then [1] convert it to an Attr-DXL and then [2] define a filter that hides objects that have no value for that attr-DXL.

-Louie

Re: Find Out Links
josiah820 - Mon Jun 17 14:22:59 EDT 2013

Okay, it turns out that I mixed up what I am supposed to do here.  I want to HIDE the outLinks.  So I'm thinking that, using the same idea from the code above, I would "accept" everything, and then:

(for object o and module m)

for o in m do

{

blObjHasLinks = false

for p in current Project do

{

itemType = type p

if(itemType == "Formal")

{

fullModName = fullName(p)

modName = name(p)

for lkOut in o -> modName do

{

reject o

}

}

}

}

I can't figure out why this wouldn't make only the objects which do NOT have out links display.  Any ideas?

Thanks

 

 

 

 

Re: Find Out Links
HazelWoodcock - Mon Jun 17 14:51:47 EDT 2013

Richard_Hesketh - Wed Jun 12 03:12:46 EDT 2013

Try the attached code. I couldn't (easily) get it to format nicely for display in the post!

Richard,

Use the blockquote formatting - second row, just after indent and outdent.  It will look like this (which isn't too terrible)...

Module modCurr = current
Object objCurr, objTarg
Link   lkOut

bool blObjHasLinks = false

for objCurr in modCurr do
{
    blObjHasLinks = false
    
    for lkOut in objCurr -> "*" do // for each outgoing link via any link module
    {
        blObjHasLinks = true
    }
    
    if (blObjHasLinks == true)
    {
        print (identifier objCurr) "\t" (objCurr."Object Text") "\n"
        for lkOut in objCurr -> "*" do // for each outgoing link via any link module
        {
            objTarg = target lkOut
            print "\t" (identifier objTarg) "\t" (objTarg."Object Text") "\n"
        }
    }
}

Re: Find Out Links
Johnny_P - Tue Jun 18 01:47:01 EDT 2013

josiah820 - Mon Jun 17 14:22:59 EDT 2013

Okay, it turns out that I mixed up what I am supposed to do here.  I want to HIDE the outLinks.  So I'm thinking that, using the same idea from the code above, I would "accept" everything, and then:

(for object o and module m)

for o in m do

{

blObjHasLinks = false

for p in current Project do

{

itemType = type p

if(itemType == "Formal")

{

fullModName = fullName(p)

modName = name(p)

for lkOut in o -> modName do

{

reject o

}

}

}

}

I can't figure out why this wouldn't make only the objects which do NOT have out links display.  Any ideas?

Thanks

 

 

 

 

Hi!

Is it possible, that you just forgot the "filtering on" line?

Also: a "for link on object" loop expects a linkmodule name. It seems that you are giving it a formal module name.

for lkOut in o -> linkModName

 

The following code rejects all objects with out-links through any linkmodule.

Module m = current
Object o = null
Link lOut = null

for o in m do
{
    for lOut in o -> "*" do
    {
        reject o
        break
    }
}

filtering on

Regards

Johnny

Re: Find Out Links
GregM_dxler - Tue Jun 18 10:03:33 EDT 2013

Johnny_P - Tue Jun 18 01:47:01 EDT 2013

Hi!

Is it possible, that you just forgot the "filtering on" line?

Also: a "for link on object" loop expects a linkmodule name. It seems that you are giving it a formal module name.

for lkOut in o -> linkModName

 

The following code rejects all objects with out-links through any linkmodule.

Module m = current
Object o = null
Link lOut = null

for o in m do
{
    for lOut in o -> "*" do
    {
        reject o
        break
    }
}

filtering on

Regards

Johnny

Don't forget about setting the ancestors off.  Depending on your last filter setting, it might affect the filter.  This little bugger has caught me a few times.

Greg

Re: Find Out Links
josiah820 - Tue Jun 18 13:03:22 EDT 2013

Johnny_P - Tue Jun 18 01:47:01 EDT 2013

Hi!

Is it possible, that you just forgot the "filtering on" line?

Also: a "for link on object" loop expects a linkmodule name. It seems that you are giving it a formal module name.

for lkOut in o -> linkModName

 

The following code rejects all objects with out-links through any linkmodule.

Module m = current
Object o = null
Link lOut = null

for o in m do
{
    for lOut in o -> "*" do
    {
        reject o
        break
    }
}

filtering on

Regards

Johnny

And then to make it work for in-links only, I should just flip it around?:

(for linkIn in o <- "*" do)

?

Thanks

Re: Find Out Links
llandale - Tue Jun 18 14:19:50 EDT 2013

This is two problems.

[1]  Create a layout using the wizard to display info from outlinked objects.  When happy, convert it to an attr-DXL
[2]  Filter the module based on whether that attribute is not null.

-Louie

Re: Find Out Links
llandale - Tue Jun 18 14:23:42 EDT 2013

Johnny_P - Tue Jun 18 01:47:01 EDT 2013

Hi!

Is it possible, that you just forgot the "filtering on" line?

Also: a "for link on object" loop expects a linkmodule name. It seems that you are giving it a formal module name.

for lkOut in o -> linkModName

 

The following code rejects all objects with out-links through any linkmodule.

Module m = current
Object o = null
Link lOut = null

for o in m do
{
    for lOut in o -> "*" do
    {
        reject o
        break
    }
}

filtering on

Regards

Johnny

After "m=current" I think you need "filtering off"

After "for o in m" I think you need "accept o".

-Louie

Re: Find Out Links
llandale - Tue Jun 18 14:28:38 EDT 2013

josiah820 - Mon Jun 17 14:22:59 EDT 2013

Okay, it turns out that I mixed up what I am supposed to do here.  I want to HIDE the outLinks.  So I'm thinking that, using the same idea from the code above, I would "accept" everything, and then:

(for object o and module m)

for o in m do

{

blObjHasLinks = false

for p in current Project do

{

itemType = type p

if(itemType == "Formal")

{

fullModName = fullName(p)

modName = name(p)

for lkOut in o -> modName do

{

reject o

}

}

}

}

I can't figure out why this wouldn't make only the objects which do NOT have out links display.  Any ideas?

Thanks

 

 

 

 

Your inner "for p in Project" loop is hopeless. 

  • For one thing, for lnk in o ->"*" gets all outgoing links. 
  • For another, for lnk in o->Name only gets links in the Name LINK MODULE; but you are using it only for "Formal" modules and therefore you can expect zero link hits.
  • If "Name" is unqualified, then you will only find links if the LM is in the "current Folder".  No, always use fullName in that situation.
  • What kind of variable is "p"?  Is it an "Item"?

Abandon that in favor of Johnny's script.

-Louie

Re: Find Out Links
josiah820 - Tue Jun 18 15:19:54 EDT 2013

I went with Johnny's script, but I can't figure out how to make it ONLY display in-links.  I'm not trying to trace the links anymore, just trying to determine if it is an in-link or an out-link.  My only current issue, then, is showing only the in-links.  Other than that, everything else works great.

Re: Find Out Links
llandale - Tue Jun 18 15:36:25 EDT 2013

josiah820 - Tue Jun 18 15:19:54 EDT 2013

I went with Johnny's script, but I can't figure out how to make it ONLY display in-links.  I'm not trying to trace the links anymore, just trying to determine if it is an in-link or an out-link.  My only current issue, then, is showing only the in-links.  Other than that, everything else works great.

There is no in-"Link" handle unless the source module is open.  But since all you want is to know IF there is a "Link", you can realistically use a "LinkRef" variable as a flag for that.  The guts of some code may look like this:

  • LinkRef lr
  • reject(o)
  • for lr in o<-"*" do {accept(o)}

-Louie

Re: Find Out Links
josiah820 - Tue Jun 18 16:11:21 EDT 2013

llandale - Tue Jun 18 15:36:25 EDT 2013

There is no in-"Link" handle unless the source module is open.  But since all you want is to know IF there is a "Link", you can realistically use a "LinkRef" variable as a flag for that.  The guts of some code may look like this:

  • LinkRef lr
  • reject(o)
  • for lr in o<-"*" do {accept(o)}

-Louie

Got it!  Thanks!! Last question for this program:  Is there any way to disable the execution timeout warning with DXL?

 

Re: Find Out Links
llandale - Wed Jun 19 12:04:29 EDT 2013

josiah820 - Tue Jun 18 16:11:21 EDT 2013

Got it!  Thanks!! Last question for this program:  Is there any way to disable the execution timeout warning with DXL?

 

put this in your code, presumably near the top

pragma runLim, 0

Put EXACTLY that, use copy-paste.  Turns out that cannot be the very last line in the DXL; there must at least be an empty line after it.

The default value is  1000000, where "0" means "no timeout".  When debugging you should use an explicit timeout to avoid infinate loops.

-Louie

Re: Find Out Links
josiah820 - Wed Jun 19 12:38:40 EDT 2013

llandale - Wed Jun 19 12:04:29 EDT 2013

put this in your code, presumably near the top

pragma runLim, 0

Put EXACTLY that, use copy-paste.  Turns out that cannot be the very last line in the DXL; there must at least be an empty line after it.

The default value is  1000000, where "0" means "no timeout".  When debugging you should use an explicit timeout to avoid infinate loops.

-Louie

Okay, thanks!  Someone told me to use that at one point, and I never knew what it was for.  Thanks for your help!